package com.whale.kernel.domain;

import java.io.Serializable;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

public class HtmlMenu implements Serializable, Keyable {

	private static final long serialVersionUID = 4845136447308846783L;

	private Long id;
	@NotNull
	private String path;
	@NotNull
	@Size(max = 1000)
	private String name;
	@NotNull
	private Integer menuOrder;
	private String menuGroupId;
	private HtmlMenu parentMenu;

	public HtmlMenu() {
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String menuId) {
		this.path = menuId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public HtmlMenu getParentMenu() {
		return parentMenu;
	}

	public void setParentMenu(HtmlMenu parentMenu) {
		this.parentMenu = parentMenu;
	}

	public String getMenuGroupId() {
		return menuGroupId;
	}

	public void setMenuGroupId(String menuGroupId) {
		this.menuGroupId = menuGroupId;
	}

	public Integer getMenuOrder() {
		return menuOrder;
	}

	public void setMenuOrder(Integer menuOrder) {
		this.menuOrder = menuOrder;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((path == null) ? 0 : path.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		HtmlMenu other = (HtmlMenu) obj;
		if (path == null) {
			if (other.path != null)
				return false;
		} else if (!path.equals(other.path))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "HtmlMenu [id=" + id + ", name=" + name
				+ ", menuOrder=" + menuOrder + ", menuGroupId=" + menuGroupId + "]";
	}

}
